package org.evil.dog.gateway.exception;

import org.evil.dog.gateway.enums.ErrorEnum;

import java.util.HashMap;
import java.util.Map;

public class SysAppException extends RuntimeException {
    private int code;
    private String info;
    public SysAppException(ErrorEnum errorEnum) {
        super(errorEnum.getInfo());
        this.code = errorEnum.getCode();
        this.info = errorEnum.getInfo();
    }
    public String getInfo() {
        return info;
    }
    public void setInfo(String info) {
        this.info = info;
    }

    public SysAppException(int code, String info) {
        super(info);
        this.code = code;
        this.info = info;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public Map<String,Object> getMsg() {
        Map<String,Object> map=new HashMap<>();
        map.put("msg",info);
        return map;
    }
}
